package test1;

import java.util.concurrent.ConcurrentHashMap;

public class Test {
    public static void main(String[] args) throws InterruptedException {
        ConcurrentHashMap<Integer, Integer> map = new ConcurrentHashMap<>();

        new Thread(() -> {
            for (int i = 1; i <= 10000; i++) {
                map.put(i, i);
            }
        }).start();
        new Thread(() -> {
            for (int i = 10001; i <= 20000; i++) {
                map.put(i, i);
            }
        }).start();

        Thread.sleep(2000);

        for (int i = 1; i <= map.size(); i++) {
            System.out.println(map.get(i));
        }
    }
}
